home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2004 #6
/
Amiga Plus CD - 2004 - No. 06.iso
/
AmigaPlus
/
Begleitmaterial
/
50Tools
/
Grafik
/
PerfectPaint
/
rexx
/
general
/
SavePng_Brush2.rx
< prev
next >
Wrap
Text File
|
2003-06-26
|
3KB
|
178 lines
/* arexx Script
SAVE Picture in PNG format
need 'PNGtool' in PerfectPaint:tools/
*/
options results
parse ARG Port b
ADDRESS value Port
pp_AvoidRefresh
file=""
file2=""
option=0
compression=5
interlace=0
version=0
if EXISTS('PerfectPaint:Prefs/Rexx_Prefs/SavePng_Brush2') THEN DO
IF OPEN('lfile','PerfectPaint:Prefs/Rexx_Prefs/SavePng_Brush2', "R") then DO
file = READLN('lfile')
option=READLN('lfile')
compression=READLN('lfile')
interlace=READLN('lfile')
version=READLN('lfile')
CALL CLOSE('lfile')
file2=""
do i=1 to LENGTH(file)
a=SUBSTR(file,i,1)
if a=" " then DO
a="*"
END
file2=file2||a
END
file=file2
END
END
pp_showscreen
pp_GetDepth
D=result
IF D<24 then DO
pp_DialogInit 250 160 "*Save*Png*Brush*" 6
END
ELSE DO
pp_DialogInit 250 195 "*Save*Png*Brush*" 9
END
pp_String 0 50 12 150 16 "Name" 1 100 file
n=LASTPOS('/',file)
if n=0 then DO
n=LASTPOS(':',file)
file=SUBSTR(file,1,n)
END
else DO
file=SUBSTR(file,1,n)
END
pp_Getfile 1 205 13 0 "Save*Png" 0 file
IF D<24 then DO
pp_Cycle 2 100 32 100 16 "Transparency" 1 "No|Yes" option
END
ELSE DO
pp_Cycle 2 95 32 130 16 "Transparency" 1 "No|Use*Current*Mask" option
END
pp_Slider 3 100 52 100 16 "Compression" 1 0 9 compression
pp_Cycle 4 100 72 100 16 "Interlaced" 1 "No|Yes" interlace
pp_Cycle 5 100 102 110 16 "Version" 1 "68000|PPC*(WarpUp)" version
IF D>8 then DO
pp_Text 6 10 145 "'PBM.datatype'*must*be*installed,"
pp_text 7 10 155 "if*you*want*to*save*your*PNG*Brush*with"
pp_text 8 10 165 "Transparency."
END
pp_Dialog
rc=result
if rc=0 then
do
pp_PermitRefresh
EXIT
end
pp_GetDialog 0
file=result
pp_GetDialog 2
option=result
pp_GetDialog 3
compression=result
pp_GetDialog 4
interlace=result
pp_GetDialog 5
version=result
CALL SavePrefs('SavePng_Brush2',file,option,compression,interlace,version)
ADDRESS value Port
pp_SavePrefs 0 1 100 0 0
AA0="T:pp_Picture.iff"
pp_bSave AA0 0 1
IF option=0 then DO
AA=" T=-1 "
END
ELSE DO
IF D=24 then DO
AA1="T:pp_Stencil.stn"
pp_InvBrushStencil
pp_bmSave AA1
pp_InvBrushStencil
AA=" A="||AA1||" "
END
ELSE DO
AA=" T=0 "
END
END
AI=""
IF interlace=1 then DO
AI=" Interlaced "
END
AC=" C="||compression
pp_asay 'Making*PNG*file|Please*wait*...'
address COMMAND
if version=0 then do
'perfectpaint:tools/PNGtool '||AA0||' '||file||' '||AA||AI||AC
end
else do
'perfectpaint:tools/PNGtoolPPC '||AA0||' '||file||' '||AA||AI||AC
end
'delete >nil: '||AA0
'delete >nil: '||AA1
ADDRESS value Port
pp_SaveIconFor file 0
pp_closeasay
pp_PermitRefresh
EXIT
SavePrefs: PROCEDURE
Prefname='PerfectPaint:Prefs/Rexx_Prefs/'||ARG(1)
if EXISTS(Prefname) THEN DO
ADDRESS COMMAND
'delete >nil: '||Prefname
END
IF OPEN('pfile',PrefName,'W') THEN DO
do i=2 to ARG()
CALL WRITELN('pfile',ARG(i))
end
CALL CLOSE('pfile')
RETURN